package com.ruoyi.payLog.service.impl;

import java.util.List;

import com.ruoyi.businessOrder.domain.BusinessOrder;
import com.ruoyi.businessOrder.service.impl.BusinessOrderServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.employee.domain.Employee;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.payLog.mapper.PayLogsMapper;
import com.ruoyi.payLog.domain.PayLogs;
import com.ruoyi.payLog.service.IPayLogsService;

/**
 * 支付记录信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-16
 */
@Service
public class PayLogsServiceImpl implements IPayLogsService 
{
    private static final Logger log = LoggerFactory.getLogger(BusinessOrderServiceImpl.class);

    @Autowired
    private PayLogsMapper payLogsMapper;


    /**
     * 查询支付记录信息
     * 
     * @param paymentId 支付记录信息主键
     * @return 支付记录信息
     */
    @Override
    public PayLogs selectPayLogsByPaymentId(Long paymentId)
    {
        return payLogsMapper.selectPayLogsByPaymentId(paymentId);
    }

    /**
     * 根据订单id查询支付记录信息
     * @param orderId
     * @return
     */
    @Override
    public PayLogs selectPayLogsByOrderId(Long orderId) {
        return payLogsMapper.selectPayLogsByOrderId(orderId);
    }

    /**
     * 根据商品订单id查询支付记录信息
     * @param orderId
     * @return
     */
    @Override
    public PayLogs getPayLogsByGoodsOrderId(Long orderId) {
        return payLogsMapper.getPayLogsByGoodsOrderId(orderId);
    }

    /**
     * 查询支付记录信息列表
     * 
     * @param payLogs 支付记录信息
     * @return 支付记录信息
     */
    @Override
    public List<PayLogs> selectPayLogsList(PayLogs payLogs)
    {
        return payLogsMapper.selectPayLogsList(payLogs);
    }

    /**
     * 新增支付记录信息
     * 
     * @param payLogs 支付记录信息
     * @return 结果
     */
    @Override
    public int insertPayLogs(PayLogs payLogs)
    {
        // 设置创建人
        payLogs.setCreateBy(SecurityUtils.getUsername());
        // 设置创建时间
        payLogs.setCreateTime(DateUtils.getNowDate());
        return payLogsMapper.insertPayLogs(payLogs);
    }

    /**
     * 修改支付记录信息
     * 
     * @param payLogs 支付记录信息
     * @return 结果
     */
    @Override
    public int updatePayLogs(PayLogs payLogs)
    {
        // 添加修改人
        payLogs.setUpdateBy("system");
        payLogs.setUpdateTime(DateUtils.getNowDate());
        return payLogsMapper.updatePayLogs(payLogs);
    }

    /**
     * 批量删除支付记录信息
     * 
     * @param paymentIds 需要删除的支付记录信息主键
     * @return 结果
     */
    @Override
    public int deletePayLogsByPaymentIds(Long[] paymentIds)
    {
        return payLogsMapper.deletePayLogsByPaymentIds(paymentIds);
    }

    /**
     * 删除支付记录信息信息
     * 
     * @param paymentId 支付记录信息主键
     * @return 结果
     */
    @Override
    public int deletePayLogsByPaymentId(Long paymentId)
    {
        return payLogsMapper.deletePayLogsByPaymentId(paymentId);
    }



}
